Operating Systems

Overview

  • What is an Operating Systems?
  • Introduce the basic requirements for an Embedded Operating System.
  • Introduce approaches to supporting OS functions within an embedded project.
  • Discuss scheduling without an operating system present.
  • Introduce minimum operating system’s features.
  • Introduce threading features of UCOS-II.
  • Introduce scheduling with an operating system.

What is an Operating System

Tanenbaum/Woodhull:
“The function of an operating system is to present the user with the equivalent of an extended machine or virtual machine that is easier to program than the underlying hardware”
TechWeb:
“The master control program that runs the computer”
Online Computing Dictionary:
“(OS) The low- level software which handles the interface to peripheral hardware, schedules tasks, allocates storage, and presents a default interface to the user...”

Theme

Getting work done while:

  • Handling interrupts
  • Sharing memory
  • Sharing CPU

Preemption is roughly othogonal from multitasking.

Embedded OS vs. General Purpose OS

  • Embedded systems tend to:
    • Have a special and dedicated purpose.
    • Have limited resources; memory, processing power, I/O, expansion capability.
    • Be cost sensitive.
    • Have lower distribution volumes
    • Have fewer features

What Features are Needed?

  • Memory foot print
  • Processor support
  • Responsiveness
  • Features - networking, GUI, ...
  • Development tools
  • Support
  • Development seat cost, distribution cost, total cost
  • Reliability - 24 x 7 x 365

Development Approaches

  • Monolithic
  • In-house, proprietary OS
  • Off the shelf OS

Monolithic

  • No OS
  • No real differentiation between application and system operations
  • Very small software projects, small devices

Monolithic Example

  • 8-bit integrated microprocessor with 8 channel A/D plus serial port.
    • 8-bit CPU
    • RS-232 COM
    • 8 channel A/D
#define MAX_CHANNEL 8
#define MAX_MESSAGE 14
main() {
        uchar channel;                 // current channel
        uchar temperature;             // temperature reading
        char message[MAX_MESSAGE];     // character message initialize chip

        for(channel=0;TRUE;++channel){ //foreverloop
        if (channel >= MAX_CHANNEL) {
                channel = 0;
        }

        temperature = ReadAD(channel);
        FormatTemperature(temperature, message);
        SendMessage(message);
        Delay(60 seconds);
        }
}

In-house -proprietary OS

  • Do you have the in-house expertise
  • However...
    • Is it your core expertise?
  • Do COTS OS’s have the required features/performance?
    • Are you stacking the deck?
  • Can you amortize the development and maintenance over many products
    • Flight system Executive for Boeing/Airbus
    • 10+ year life, billions $ worth of products

Off the shelf OS

  • COTS - Commercial Off-The-Shelf system
  • Vendors
    • Dozens of vendors to choose from
    • Wide feature set
    • Wide business model approaches
  • Tested, supported, maintained
    • Amount depends on vendor
  • Third party support
    • Consultants, libraries, BSPs, reference platforms, device drivers

Minimum OS Features

  • Efficient Task Scheduling
    • Processes and threads
  • Mutual Exclusion primitives
    • Semaphores, events, etc
  • Memory Management
    • Global heaps, MMUs, stacks
  • Initialization and boot loading

Preemptive vs. Non-preemptive OS

  • Non-preemptive
    • Tasks/Functions run to completion or until task gives up control
  • Except for interrupts
    • MS-DOS is non-preemptive
    • Non-preemptive operating system is an oxymoron for most embedded systems
    • Often called Cooperative Multi-tasking * Windows 95
  • Preemptive
    • Higher priority tasks preempt running lower priority tasks
    • Essential for many (most) embedded real-time systems